<template>
  <div :class="disabled ? prefixCls + '-disabled' : ''">
    <fieldset :disabled="disabled">
      <slot></slot>
    </fieldset>
  </div>
</template>

<script lang="ts">
import {defineComponent} from 'vue';
import {useDesign} from '/@/hooks/web/useDesign';

export default defineComponent({
    name: 'JFormContainer',
    props: {
      disabled: {
        type: Boolean,
        default: false,
        required: false,
      },
    },
    setup: () => {
      const { prefixCls } = useDesign('form-container');

      return {
        prefixCls
      }
    }
  });
</script>

<style lang="less">
  @prefix-cls: ~'@{namespace}-form-container';
  .@{prefix-cls}-disabled {
    cursor: not-allowed;

    fieldset[disabled] {
      -ms-pointer-events: none;
      pointer-events: none;
    }

    .ant-select {
      -ms-pointer-events: none;
      pointer-events: none;
    }

    .ant-upload-select {
      display: none;
    }

    .ant-upload-list {
      cursor: grabbing;
    }

    fieldset[disabled]{
      .anticon-delete{
        display: none !important;
      }
    }
  }

  .@{prefix-cls}-disabled fieldset[disabled] .ant-upload-list {
    -ms-pointer-events: auto !important;
    pointer-events: auto !important;
  }

  .@{prefix-cls}-disabled .ant-upload-list-item-actions .anticon-delete,
  .@{prefix-cls}-disabled .ant-upload-list-item .anticon-close {
    display: none;
  }
</style>
